{include file="public/header"}

<body>

	<section id="container" class="">
		<!--header start-->
		{include file="public/headtop" /}
		<!--header end-->
		<!--sidebar start-->
		<aside>
			<div id="sidebar"  class="nav-collapse ">
				<!-- sidebar menu start-->
				{include file="public/menu" /}
				<!-- sidebar menu end-->
			</div>
		</aside>
		<!--sidebar end-->
		<!--main content start-->
		<section id="main-content">
			<section class="wrapper site-min-height">
				<!-- page start-->
				<div class="row">
					<div class="col-lg-12">
						{include file="public/nav" webnavname="主机管理"}
					</div>
					<div class="col-lg-6">
						<!-- <div class="btn-group">
							<button id="editable-sample_new" class="btn green success" data-toggle="modal" href="#incUser">
								新增用户 <i class="fa fa-plus"></i>
							</button>
						</div> -->
						
					</div>
					<div class="col-lg-6">
						<input type="text"  class="form-control medium" id="search" placeholder="搜索服务器IP，全部请为空">
					</div>
					<div class="col-lg-12">
						
						<section class="panel">
							<header class="panel-heading">
								主机列表
							</header>
							<table class="table table-striped table-advance table-hover">
								<thead>
									<tr>
										<th>ID</th>
										<th><i class="fa fa-user"></i> 账号</th>
										<th class="hidden-phone"> 域名</th>
										<th class="hidden-phone"><i class="fa fa-envelope"></i> 服务器IP</th>
										<th><i class="fa fa-rmb"></i> 时长/月</th>
										<th class="hidden-phone"><i class="fa fa-envelope"></i> 创建时间</th>
										<th class="hidden-phone"><i class="fa fa-envelope"></i> 支付时间</th>
										<th>付款金额</th>
										<th><i class="fa fa-edit"></i> 订单状态</th>
										<th>操作</th>
									</tr>
								</thead>
								<tbody>
									{volist name="orderList" id="order" empty="暂未订单"}
									<tr id="order_{$order.id}">
										<th>{$order.id}</th>
										<th><a href="/admin/info/{$order.userid}.html">{$order.user}</a></th>
										<th class="hidden-phone">{$order.domain}</th>
										<th class="hidden-phone">{$order.hostip}</th>
										<th>{$order.quantity}</th>
										<th class="hidden-phone">{$order.ctime}</th>
										<th class="hidden-phone">{$order.paytime}</th>
										<th>{$order.payment}</th>
										<th>
											<span class="label label-{switch name="order.status" }
												{case value="2"}success{/case}
												{case value="1"}info{/case}
												{case value="0"}danger{/case}
												{/switch}">
												{switch name="order.status" }
												{case value="2"}已开通{/case}
												{case value="1"}已支付{/case}
												{case value="0"}未支付{/case}
												{/switch}
											</span>
										</th>
										<td>
											<button class="btn btn-danger btn-xs" data-toggle="modal" href="#delOrder" onclick="$('#UserID').val({$order.id})"><i class="fa fa-trash-o "></i></button>
										</td>
									</tr>
									{/volist}

								</tbody>
							</table>
							<div class="text-center">
								{$pageNum}
							</div>

						</section>
					</div>
				</div>

				<div class="row">
					<div class="col-lg-12">
						<section class="panel">
							<div class="panel-body">
								<input type="hidden" name="UserID" id="UserID">
								<div class="modal fade  modal-dialog-center" id="delOrder" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
									<div class="modal-dialog modal-sm">
										<div class="modal-content-wrap">
											<div class="modal-content">
												<div class="modal-header">
													<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
													<h4 class="modal-title">是否删除该主机</h4>
												</div>
												<div class="modal-body">

													此主机一旦删除将无法还原，请谨慎操作！

												</div>
												<div class="modal-footer">
													<button data-dismiss="modal" class="btn btn-default" type="button">关闭</button>

													<button class="btn btn-warning" type="button" onclick="del($('#UserID').val())"> 删除</button>
												</div>
											</div>
										</div>
									</div>
								</div>
								<div class="modal fade" id="EchoMsg" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
									<div class="modal-dialog modal-sm">
										<div class="modal-content-wrap">
											<div class="modal-content">
												<div class="modal-header">
													<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
													<h4 class="modal-title">消息通知</h4>
												</div>
												<div class="modal-body text-center" id="msgVal">

												</div>
												<div class="modal-footer">
													<button class="btn btn-danger" type="button" data-dismiss="modal"> OK</button>
												</div>
											</div>
										</div>
									</div>
								</div>
							</div>
						</section>
					</div>
				</div>
				<!-- page end-->
			</section>
		</section>
		<!--main content end-->
		<!-- Right Slidebar start -->
		{include file="public/slidright"}
		<!-- Right Slidebar end -->
		<!--footer start-->
		<footer class="site-footer">
			{include file="public/footer"}
		</footer>
		<!--footer end-->
	</section>

	<!-- js placed at the end of the document so the pages load faster -->
	<script src="__STATIC__/js/jquery.js"></script>
	<script src="__STATIC__/js/bootstrap.min.js"></script>
	<script class="include" type="text/javascript" src="__STATIC__/js/jquery.dcjqaccordion.2.7.js"></script>
	<script src="__STATIC__/js/jquery.scrollTo.min.js"></script>
	<script src="__STATIC__/js/jquery.nicescroll.js" type="text/javascript"></script>
	<script src="__STATIC__/js/respond.min.js" ></script>

	<!--right slidebar-->
	<script src="__STATIC__/js/slidebars.min.js"></script>


	<!--common script for all pages-->
	<script src="__STATIC__/js/common-scripts.js"></script>
	<script type="text/javascript">
		function del(id){
			$('#delOrder').modal('hide');
			$.post('', {id: id,type:'del'}, function(data, textStatus, xhr) {
				if(data.code!=200){
					EchoMsg(data.msg,'/admin/order.html');
				}else{
					$('#order_'+id).remove();
					EchoMsg(data.msg,'/admin/order.html');
				}

			});
		}

		$(function() {
			$('#search').on('keypress',function(event){
				if(event.keyCode == "13"){  
					window.location.href="?search="+$('#search').val();
				}
			});
		});
		function EchoMsg(msg,local){
			$('#msgVal').html(msg);
			$('#EchoMsg').modal('show');
			if(local){
				$('#EchoMsg').on('hidden.bs.modal', function () {
					window.location.href = local;
				})
			}
		}
	</script>

</body>
</html>